package com.pgy.backend.service.impl;

import com.pgy.backend.entity.GradeRule;
import com.pgy.backend.mapper.GradeRuleMapper;
import com.pgy.backend.service.IGradeRuleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class GradeRuleImpl implements IGradeRuleService {
    @Resource
    private GradeRuleMapper gradeRuleMapper;

    @Override
    public List<GradeRule> findAll() {
        return gradeRuleMapper.findAll();
    }

    @Override
    public int updateById(GradeRule gradeRule) {
        Integer a=gradeRuleMapper.updateById(gradeRule);
        if (a!=null){
            return 1;
        }
        else return 0;
    }

    @Override
    public GradeRule getById(int id) {
        GradeRule g = gradeRuleMapper.getById(id);
        return g;
    }

    @Override
    public int insert(GradeRule gradeRule) {
        if (gradeRuleMapper.insert(gradeRule)!=null){
            return 1;
        }
        else return 0;
    }

    @Override
    public int delete(int id) {
        if (gradeRuleMapper.delete(id)!=null){
            return 1;
        }
        else return 0;
    }
}
